﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Content/Master.Master" Inherits="System.Web.Mvc.ViewPage<SCS.Core.ViewModels.DetailOrderViewModels>" %>
<%@ Import Namespace="SCS.Core" %>
<%@ Import Namespace="SCS.Core.Models" %>
<%@ Import Namespace="SCS.Core.ViewModels" %>
<%@ Import Namespace="SCS.Core.Controllers" %>
<%@ Import Namespace="SCSService" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Chi tiết đơn hàng
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<%--   <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>--%>

<script language="javascript">

    function SaveStatus(dropDownList, id) {
        var selectedReport = dropDownList.options[dropDownList.selectedIndex];
        var selects = selectedReport.value;
        actionChangeStatus(selects, id);
    }
    function actionChangeStatus(values, id) {
        var url = '<%=Url.Action("ChangeStatusShipment","HomeMaster")%>' + '/' + id + '/' + values;
        $.getJSON(url, function (outStr) {
            $('#statusID' + id).val(outStr);
        });
    }

</script>

 <%-- <script type="text/javascript">
      $(function () {
          $("#StartDate").datepicker();
          $("#EndDate").datepicker();
      });
	</script>--%>
   <%-- <script type="text/javascript">
        function SaveStatus(dropDownList, id) {
            var selectedReport = dropDownList.options[dropDownList.selectedIndex];
            var selects = selectedReport.value;
            actionChangeStatus(selects, id);
        }
        function actionChangeStatus(values, id) {
            var url = '<%=Url.Action("ChangeStatusDiscount","Stock")%>' + '/' + id + '/' + values;
            $.getJSON(url, function (outStr) {
                $('#statusID' + id).val(outStr);
            });
        }
     </script>--%>
      <% using (Html.BeginForm("DetailOrder", "HomeMaster", FormMethod.Post, new { id = "sendFileForm", enctype = "multipart/form-data" }))
   {%>
    <div class="clear"></div>
    <div class="column full">
    <div class="box ">
        
		<h2 class="box-header"></h2>
		<div class="box-content">

                    <div id="grid">			    						               
				                 <table class="display" id="tabledata" >
                                <thead>
					                <tr>
						               <%-- <th>
                                            <a href="#" class="<%= HomeMasterController.GetGridThClass(ViewData, "OrderID") %>" 
										                onclick="<%= HomeMasterController.GetGridThOnClick(ViewData, "OrderID")%>">
								               OrderID</a>
                                        </th>--%>
                                        
                                        <th>
                                            
								                Tên người đặt hàng 
                                        </th>
                                        	               
						                <th>
							           
								                Ngày tạo
						                </th>
                                       
                                        <th>
							                
								                Số điện thoại
						                </th>
                                        <th>
							                
								                Email
						                </th>
                                       
                                        <th>
							               
								                Total
                                        <th>							           
								                Trạng thái chuyển Hàng
						                </th>
                                        
                                    
                                                                            
					                </tr>
                                               
                                </thead>
                                <% if (Model.lstDetailOrder.Count() == 0)
                                   { %>
			                        <tbody>
                                        <tr>
                                            <td colspan="6">
                                               Không tìm thấy 
                                            </td>
                                        </tr>
                                    </tbody>
		                        <% } else { %>
                                <tbody>
					                <% foreach (var item in Model.lstDetailOrder) { %>
				    
						                <tr>						                
                                            <td>
                                                <%: HomeMasterModel.GetProductNameID(item.ProductID).ToString() %>
                                            </td>

                                            <td>
                                                <%= item.CreateDate %>
                                            </td>
                                            
                                        <td>
							                <%: item.Phone %>
						                </td>
                                        <td>
							                <%: item.Email %>
						                </td>
                                
                                        <td>
							               <%: item.Total %>
						                </td>
                                        <td>
							                <% int Status = HomeMasterModel.GetStatusShipmnetByShipment(item.OrderItemID);
                                                 bool txtstatus =false ;
                                                %>
                                            
                                            <%
                                                    //bool newStatus=false;

                                                    if (Status == -1)
                                                    {
                                                        //newStatus=true;
                                                       txtstatus= true;
                                                    }
                                                    else if (Status == 1)
                                                    {
                                                        //newStatus=false;
                                                        txtstatus = false;
                                                    }
                                                %>
                                               
                                                   <%
                                                List<SelectListItem> statusDrop = new List<SelectListItem>();
                                                statusDrop.AddRange(new SelectListItem[] { 
                                                new SelectListItem{Selected=txtstatus, Text = "Đã chuyển hàng", Value = "1" },
                                                new SelectListItem{Selected=txtstatus, Text = "Chờ chuyền hàng", Value = "-1" }
                                                });
                                           %>
                                           <%= Html.DropDownList("statusID" + item.OrderItemID, statusDrop, new { onchange = "SaveStatus(this,"+ item.OrderItemID + ")" })%>
						                </td>
                                      
							               <%-- <td>
								                <%=item.StatusOrder %>
							                </td>--%>
                                       
                                          
						             </tr>
				    
					                <% } %>
					            </tbody>
                                <% } %>
                                  <tr style="visibility:hidden; height=5px" >
                                        <td>
                                            
                                        </td>

                                        <td >
                                            
                                        </td>
                                        
                                        <td >
                                            From: <%=Html.TextBoxFor(m=>m.StartDate,new { @class = "form-field datepicker"}) %>
                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                            To: <%=Html.TextBoxFor(m=>m.EndDate,new { @class = "form-field datepicker"}) %>
                                        </td>
                                        
                                        <td>
                                            <%
                                                List<SelectListItem> statusSearch = new List<SelectListItem>();
                                                statusSearch.AddRange(new SelectListItem[] { 
                                                new SelectListItem{ Text = "start", Value = "0" },
                                                new SelectListItem{ Text = "CheckOut", Value = "1" }
                                                });
                                                %>

                                                <%=Html.DropDownListFor(m => m.StatusSearch, statusSearch)%> 
                                        </td>
                                        <td>
                                            <input type="submit" value="Tìm kiếm" class="button themed"/>
                                        </td>
                                    </tr>
				                </table>
			                <!-- data -->
                              <%--  <% if (Model.lstDetailOrder.Count() > 0)
                                   { %>
			                       <% Html.RenderPartial("~/Views/Commont/Paging.ascx"); %>
		                        <% } %>
		                --%>
	                </div>  <!-- grid -->	
                
               
	    </div>
	</div>
    <div class="clear"></div>
    </div>    
<% } %>
<%--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>--%>
</asp:Content>
 